﻿@using System.Data;

<Table DataSource="data">
    @foreach (DataColumn column in _dataTable.Columns)
    {
        <PropertyColumn Property="c=>c.Field<string>(column.ColumnName)" Title="@column.ColumnName" Sortable Filterable></PropertyColumn>
    }
</Table>

@code {
    DataTable _dataTable = new DataTable();

    IEnumerable<DataRow> data => _dataTable?.AsEnumerable();

    protected override void OnInitialized()
    {
        _dataTable.Columns.Add("Name");
        _dataTable.Columns.Add("Age");
        _dataTable.Columns.Add("Address");

        _dataTable.Rows.Add("John Brown", 32, "New York No. 1 Lake Park");
        _dataTable.Rows.Add("Jim Green", 42, "London No. 1 Lake Park");
        _dataTable.Rows.Add(null, 32, "Sidney No. 1 Lake Park");

        base.OnInitialized();
    }
}
